package com.example.demo.controller;

import cn.hutool.extra.servlet.ServletUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Slf4j
public class DemoController {

    @GetMapping(value = "/dr")
    public String dr(@RequestParam String d, HttpServletRequest request) {

        // todo 判断请求IP是不是允许的范围
        log.info(ServletUtil.getClientIP(request) + "" + d);

        return "heartbeatAck=1";
    }
}
